package com.course.android.activity.ac;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.course.android.R;
import com.course.android.activity.base.BaseActivity;
import com.course.dic.ActivityCode;
import com.course.dic.ActivityIntentKey;

public class IntentTargetActivity extends BaseActivity implements View.OnClickListener {
    Button bt, bt1;

    @Override
    protected void initView() {
        bt = findViewById(R.id.bt);
        bt1 = findViewById(R.id.bt1);
        bt.setOnClickListener(this);
        bt1.setOnClickListener(this);
    }

    @Override
    protected void initData() {

    }

    @Override
    protected int bindLayout() {
        return R.layout.activity_target;
    }

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.bt) {
            finish();
        }
        if (v.getId() == R.id.bt1) {
            //todo 这里联系一下传其它类型的值 比如说数组 序列化的数据 等
            Intent intent = new Intent();
            intent.putExtra(ActivityIntentKey.RESP_TARGET_PARAM1, "param1");
            Bundle bundle = new Bundle();
            bundle.putString(ActivityIntentKey.RESP_TARGET_BUNDLE_PARAM1, "param2");
            intent.putExtras(bundle);
            setResult(ActivityCode.RESULT_OK, intent);
            finish();
        }
    }

    @Override
    protected void onActivityResultCallBack(Integer reqCode,Intent data) {

    }
}
